package com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.internetofthings.firefightingiot;

import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.alibaba.fastjson.JSON;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseService;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.utils.requestutil.HttpRequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
@Slf4j
public class FireFightingIOTService extends BaseService {

	private static final Logger logger = LoggerFactory.getLogger(FireFightingIOTService.class);


	/**
	 * 大数据
	 * @param
	 * @return
	 */
	public RespEntity getBigData(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		//汇总数据
		Map<String,Object> allMap = new HashMap<>();
		//报警单位分析:自动联网
		jsonParam.put("deviceClassify","5");
		JSON iotList = makeDataForJSON(jsonParam,"fireFightingiotJava","config","alarmBusinessAnalysis","fireFightingIOT");
		if(iotList instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject iotListN = (com.alibaba.fastjson.JSONObject)iotList;
			if(StrUtil.isNotBlank(iotListN.getString("methodCodeFlag"))){
				return RespEntity.expire();
			}
			return RespEntity.fail(((com.alibaba.fastjson.JSONObject) iotList).getString("msg"));
		}else{
			allMap.put("iotList",iotList);
		}
		//报警单位分析:电气火灾
		jsonParam.put("deviceClassify","1");
		JSON electricfireList = makeDataForJSON(jsonParam,"fireFightingiotJava","config","alarmBusinessAnalysis","fireFightingIOT");
		if(electricfireList instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject electricfireListN = (com.alibaba.fastjson.JSONObject)electricfireList;
			if(StrUtil.isNotBlank(electricfireListN.getString("methodCodeFlag"))){
				return RespEntity.expire();
			}
			return RespEntity.fail(((com.alibaba.fastjson.JSONObject) electricfireList).getString("msg"));
		}else{
			allMap.put("electricfireList",electricfireList);
		}
		//报警单位分析:建筑消防用水
		jsonParam.put("deviceClassify","2");
		JSON firewaterList = makeDataForJSON(jsonParam,"fireFightingiotJava","config","alarmBusinessAnalysis","fireFightingIOT");
		if(firewaterList instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject firewaterListN = (com.alibaba.fastjson.JSONObject)firewaterList;
			if(StrUtil.isNotBlank(firewaterListN.getString("methodCodeFlag"))){
				return RespEntity.expire();
			}
			return RespEntity.fail(((com.alibaba.fastjson.JSONObject) firewaterList).getString("msg"));
		}else{
			allMap.put("firewaterList",firewaterList);
		}
		//报警单位分析:可燃气体
		jsonParam.put("deviceClassify","4");
		JSON combustiblegasList = makeDataForJSON(jsonParam,"fireFightingiotJava","config","alarmBusinessAnalysis","fireFightingIOT");
		if(combustiblegasList instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject combustiblegasListN = (com.alibaba.fastjson.JSONObject)combustiblegasList;
			if(StrUtil.isNotBlank(combustiblegasListN.getString("methodCodeFlag"))){
				return RespEntity.expire();
			}
			return RespEntity.fail(((com.alibaba.fastjson.JSONObject) combustiblegasList).getString("msg"));
		}else{
			allMap.put("combustiblegasList",combustiblegasList);
		}
		//报警单位分析:可视化
		jsonParam.put("deviceClassify","6");
		JSON firefightingvisualizationList = makeDataForJSON(jsonParam,"fireFightingiotJava","config","alarmBusinessAnalysis","fireFightingIOT");
		if(firefightingvisualizationList instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject firefightingvisualizationListN = (com.alibaba.fastjson.JSONObject)firefightingvisualizationList;
			if(StrUtil.isNotBlank(firefightingvisualizationListN.getString("methodCodeFlag"))){
				return RespEntity.expire();
			}
			return RespEntity.fail(((com.alibaba.fastjson.JSONObject) firefightingvisualizationList).getString("msg"));
		}else{
			allMap.put("firefightingvisualizationList",firefightingvisualizationList);
		}
		//报警单位分析:烟感
		jsonParam.put("deviceClassify","3");
		JSON independentsmokeList = makeDataForJSON(jsonParam,"fireFightingiotJava","config","alarmBusinessAnalysis","fireFightingIOT");
		if(independentsmokeList instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject independentsmokeListN = (com.alibaba.fastjson.JSONObject)independentsmokeList;
			if(StrUtil.isNotBlank(independentsmokeListN.getString("methodCodeFlag"))){
				return RespEntity.expire();
			}
			return RespEntity.fail(((com.alibaba.fastjson.JSONObject) independentsmokeList).getString("msg"));
		}else{
			allMap.put("independentsmokeList",independentsmokeList);
		}
		return RespEntity.success(allMap);
	}

	/**
	 * web端大数据排行接口
	 * @param
	 * @return
	 */
	public RespEntity webBigData(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return restJava(jsonParam,"fireFightingiotJava","webBigData","fireFightingIOT");
	}
	/**
	 * 报警单位top5
	 * @param
	 * @return
	 */
	public RespEntity alarmBusinessAnalysisList(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		jsonParam.put("nums",5);
		//报警单位分析
		JSON alarmBusinessAnalysisObject = makeDataForJSON(jsonParam,"fireFightingiotJava","config","alarmBusinessAnalysis","fireFightingIOT");
		if(alarmBusinessAnalysisObject instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject alarmBusinessAnalysisObjectN = (com.alibaba.fastjson.JSONObject)alarmBusinessAnalysisObject;
			if(StrUtil.isNotBlank(alarmBusinessAnalysisObjectN.getString("methodCodeFlag"))){
				return RespEntity.expire();
			}
			return RespEntity.fail(((com.alibaba.fastjson.JSONObject) alarmBusinessAnalysisObject).getString("msg"));
		}else{
			return RespEntity.success(alarmBusinessAnalysisObject);
		}

	}
	/**
	 * web端大数据下方分类统计
	 * @param
	 * @return
	 */
	public RespEntity webBigDataForClassify(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return restJava(jsonParam,"fireFightingiotJava","webBigDataForClassify","fireFightingIOT");
	}

	/**
	 * 首页数据
	 * @param
	 * @return
	 */
	public RespEntity getHomePageData(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		//汇总数据
		Map<String,Object> allMap = new HashMap<>();
		//今日报警
		com.alibaba.fastjson.JSONObject todayAlarmObject = makeData(jsonParam,"fireFightingiotJava","config","todayAlarm","fireFightingIOT");
		if(StrUtil.isNotBlank(todayAlarmObject.getString("methodCodeFlag"))) return RespEntity.expire();
		if(StrUtil.isNotBlank(todayAlarmObject.getString("methodErrorFlag"))) return RespEntity.fail(todayAlarmObject.getString("msg"));
		Map<String,Object> todayAlarm = new HashMap<>();
		todayAlarm.put("todayFireCount",todayAlarmObject.get("todayFireCount"));
		todayAlarm.put("todayWaterCount",todayAlarmObject.get("todayWaterCount"));
		todayAlarm.put("todaySmokeCount",todayAlarmObject.get("todaySmokeCount"));
		todayAlarm.put("todayOtherCount",todayAlarmObject.getInteger("todayOtherCount") + todayAlarmObject.getInteger("todayGasCount") + todayAlarmObject.getInteger("todaySmartEyeCount")+ todayAlarmObject.getInteger("todayFireExtinguisherEyeCount")+ todayAlarmObject.getInteger("todayWaterImmersionCount"));
		todayAlarm.put("allCount",todayAlarmObject.get("allCount"));
		allMap.put("todayAlarm",todayAlarm);
		//一周报警
		JSON weekAlarmObject = makeDataForJSON(jsonParam,"fireFightingiotJava","config","weekAlarm","fireFightingIOT");
		if(weekAlarmObject instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject weekAlarmObjectN = (com.alibaba.fastjson.JSONObject)weekAlarmObject;
			if(StrUtil.isNotBlank(weekAlarmObjectN.getString("methodCodeFlag"))){
				return RespEntity.expire();
			}
			return RespEntity.fail(((com.alibaba.fastjson.JSONObject) weekAlarmObject).getString("msg"));
		}else{
			allMap.put("weekAlarmList",weekAlarmObject);
		}
		//设备统计
		com.alibaba.fastjson.JSONObject todayDeviceCountByStateObject = makeData(jsonParam,"fireFightingiotJava","config","todayDeviceCountByState","device");
		if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodCodeFlag"))) return RespEntity.expire();
		if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodErrorFlag"))) return RespEntity.fail(todayDeviceCountByStateObject.getString("msg"));
		allMap.put("todayDeviceCountByState",todayDeviceCountByStateObject);
		if(jsonParam.getStr("userType").equals("1")){
			//报警单位分析
			JSON alarmBusinessAnalysisObject = makeDataForJSON(jsonParam,"fireFightingiotJava","config","alarmBusinessAnalysis","fireFightingIOT");
			if(alarmBusinessAnalysisObject instanceof com.alibaba.fastjson.JSONObject){
				com.alibaba.fastjson.JSONObject alarmBusinessAnalysisObjectN = (com.alibaba.fastjson.JSONObject)alarmBusinessAnalysisObject;
				if(StrUtil.isNotBlank(alarmBusinessAnalysisObjectN.getString("methodCodeFlag"))){
					return RespEntity.expire();
				}
				return RespEntity.fail(((com.alibaba.fastjson.JSONObject) alarmBusinessAnalysisObject).getString("msg"));
			}else{
				allMap.put("alarmBusinessAnalysisList",alarmBusinessAnalysisObject);
			}
			//联网单位统计
			com.alibaba.fastjson.JSONObject businessCount = makeData(jsonParam,"businessJava","config","businessCount","business");
			if(StrUtil.isNotBlank(businessCount.getString("methodCodeFlag"))) return RespEntity.expire();
			if(StrUtil.isNotBlank(businessCount.getString("methodErrorFlag"))) return RespEntity.fail(businessCount.getString("msg"));
			allMap.put("businessCount",businessCount);
		}
		//报警类型占比
		Map<String,Object> percentage = new HashMap<>();
		percentage.put("voltageProportion",todayAlarmObject.get("voltageProportion"));
		percentage.put("currentProportion",todayAlarmObject.get("currentProportion"));
		percentage.put("temperatureProportion",todayAlarmObject.get("temperatureProportion"));
		percentage.put("leakageCurrentProportion",todayAlarmObject.get("leakageCurrentProportion"));
		allMap.put("percentage",percentage);
		return RespEntity.success(allMap);
	}
	/**
	 * 首页数据(仓库)
	 * @param
	 * @return
	 */
	public RespEntity getHomePageDataWareHouse(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		//汇总数据
		Map<String,Object> allMap = new HashMap<>();
		//今日报警
		com.alibaba.fastjson.JSONObject todayAlarmObject = makeData(jsonParam,"fireFightingiotJava","config","todayAlarm","fireFightingIOT");
		if(StrUtil.isNotBlank(todayAlarmObject.getString("methodCodeFlag"))) return RespEntity.expire();
		if(StrUtil.isNotBlank(todayAlarmObject.getString("methodErrorFlag"))) return RespEntity.fail(todayAlarmObject.getString("msg"));
		Map<String,Object> todayAlarm = new HashMap<>();
		todayAlarm.put("todayFireCount",todayAlarmObject.get("todayFireCount"));
		todayAlarm.put("todayWaterCount",todayAlarmObject.get("todayWaterCount"));
		todayAlarm.put("todayGasCount",todayAlarmObject.get("todayGasCount"));
		todayAlarm.put("todayWaterImmersionCount",todayAlarmObject.get("todayWaterImmersionCount"));
		todayAlarm.put("todaySmartEyeCount",todayAlarmObject.get("todaySmartEyeCount"));
		todayAlarm.put("todayFireExtinguisherEyeCount",todayAlarmObject.get("todayFireExtinguisherEyeCount"));
		todayAlarm.put("todaySmokeCount",todayAlarmObject.get("todaySmokeCount"));
		todayAlarm.put("todayOtherCount",todayAlarmObject.getInteger("todayOtherCount"));
		todayAlarm.put("allCount",todayAlarmObject.get("allCount"));
		allMap.put("todayAlarm",todayAlarm);
		//一周报警
		JSON weekAlarmObject = makeDataForJSON(jsonParam,"fireFightingiotJava","config","weekAlarm","fireFightingIOT");
		if(weekAlarmObject instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject weekAlarmObjectN = (com.alibaba.fastjson.JSONObject)weekAlarmObject;
			if(StrUtil.isNotBlank(weekAlarmObjectN.getString("methodCodeFlag"))){
				return RespEntity.expire();
			}
			return RespEntity.fail(((com.alibaba.fastjson.JSONObject) weekAlarmObject).getString("msg"));
		}else{
			allMap.put("weekAlarmList",weekAlarmObject);
		}
		//设备统计
		com.alibaba.fastjson.JSONObject todayDeviceCountByStateObject = makeData(jsonParam,"fireFightingiotJava","config","todayDeviceCountByState","device");
		if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodCodeFlag"))) return RespEntity.expire();
		if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodErrorFlag"))) return RespEntity.fail(todayDeviceCountByStateObject.getString("msg"));
		allMap.put("todayDeviceCountByState",todayDeviceCountByStateObject);
		if(jsonParam.getStr("userType").equals("1")){
			//报警单位分析
			JSON alarmBusinessAnalysisObject = makeDataForJSON(jsonParam,"fireFightingiotJava","config","alarmBusinessAnalysis","fireFightingIOT");
			if(alarmBusinessAnalysisObject instanceof com.alibaba.fastjson.JSONObject){
				com.alibaba.fastjson.JSONObject alarmBusinessAnalysisObjectN = (com.alibaba.fastjson.JSONObject)alarmBusinessAnalysisObject;
				if(StrUtil.isNotBlank(alarmBusinessAnalysisObjectN.getString("methodCodeFlag"))){
					return RespEntity.expire();
				}
				return RespEntity.fail(((com.alibaba.fastjson.JSONObject) alarmBusinessAnalysisObject).getString("msg"));
			}else{
				allMap.put("alarmBusinessAnalysisList",alarmBusinessAnalysisObject);
			}
			//联网单位统计
//			com.alibaba.fastjson.JSONObject businessCount = makeData(jsonParam,"businessJava","config","businessCount","business");
//			if(StrUtil.isNotBlank(businessCount.getString("methodCodeFlag"))) return RespEntity.expire();
//			if(StrUtil.isNotBlank(businessCount.getString("methodErrorFlag"))) return RespEntity.fail(businessCount.getString("msg"));
//			allMap.put("businessCount",businessCount);
		}else{
			JSON alarmBusinessAnalysisObject = makeDataForJSON(jsonParam,"fireFightingiotJava","config","getDeviceAlarmCount","fireFightingIOT");
			if(alarmBusinessAnalysisObject instanceof com.alibaba.fastjson.JSONObject){
				com.alibaba.fastjson.JSONObject alarmBusinessAnalysisObjectN = (com.alibaba.fastjson.JSONObject)alarmBusinessAnalysisObject;
				if(StrUtil.isNotBlank(alarmBusinessAnalysisObjectN.getString("methodCodeFlag"))){
					return RespEntity.expire();
				}
				return RespEntity.fail(((com.alibaba.fastjson.JSONObject) alarmBusinessAnalysisObject).getString("msg"));
			}else{
				allMap.put("alarmDeviceList",alarmBusinessAnalysisObject);
			}
		}
		//报警类型占比
		Map<String,Object> percentage = new HashMap<>();
		percentage.put("voltageProportion",todayAlarmObject.get("voltageProportion"));
		percentage.put("currentProportion",todayAlarmObject.get("currentProportion"));
		percentage.put("temperatureProportion",todayAlarmObject.get("temperatureProportion"));
		percentage.put("leakageCurrentProportion",todayAlarmObject.get("leakageCurrentProportion"));
		allMap.put("percentage",percentage);
		return RespEntity.success(allMap);
	}
	/**
	 * 实时报警列表
	 * @param
	 * @return
	 */
	public RespEntity realTimeAlarm(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return fireFightingiotJava(jsonParam,"realTimeAlarm","fireFightingIOT");
	}

	/**
	 * 获取单位详情
	 * @param
	 * @return
	 */
	public RespEntity getBusinessDetail(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		//汇总数据
		Map<String,Object> allMap = new HashMap<>();
		//单位详情
		com.alibaba.fastjson.JSONObject businessDetailObject = makeData(jsonParam,"businessJava","config","detail","business");
		if(StrUtil.isNotBlank(businessDetailObject.getString("methodCodeFlag"))) return RespEntity.expire();
		if(StrUtil.isNotBlank(businessDetailObject.getString("methodErrorFlag"))) return RespEntity.fail(businessDetailObject.getString("msg"));
		allMap.put("businessDetail",businessDetailObject);
		//消防物联网
		Map<String,Object> iotData = getIOTData(jsonParam);
		if(iotData.get("methodCodeFlag")!=null && StrUtil.isNotBlank(iotData.get("methodCodeFlag").toString())) return RespEntity.expire();
		if(iotData.get("methodErrorFlag")!=null && StrUtil.isNotBlank(iotData.get("methodErrorFlag").toString())) return RespEntity.fail(iotData.get("msg").toString());
		allMap.put("iotData",iotData);
		//电气火灾监测
		Map<String,Object> electricFireData = getElectricFireData(jsonParam);
		if(electricFireData.get("methodCodeFlag")!=null && StrUtil.isNotBlank(electricFireData.get("methodCodeFlag").toString())) return RespEntity.expire();
		if(electricFireData.get("methodErrorFlag")!=null && StrUtil.isNotBlank(electricFireData.get("methodErrorFlag").toString())) return RespEntity.fail(electricFireData.get("msg").toString());
		allMap.put("electricFireData",electricFireData);
		//建筑消防用水
		Map<String,Object> waterData = getWaterData(jsonParam);
		if(waterData.get("methodCodeFlag")!=null && StrUtil.isNotBlank(waterData.get("methodCodeFlag").toString())) return RespEntity.expire();
		if(waterData.get("methodErrorFlag")!=null && StrUtil.isNotBlank(waterData.get("methodErrorFlag").toString())) return RespEntity.fail(waterData.get("msg").toString());
		allMap.put("waterData",waterData);
		//可燃气体监测
		Map<String,Object> combustibleGasData = getCombustibleGasData(jsonParam);
		if(combustibleGasData.get("methodCodeFlag")!=null && StrUtil.isNotBlank(combustibleGasData.get("methodCodeFlag").toString())) return RespEntity.expire();
		if(combustibleGasData.get("methodErrorFlag")!=null && StrUtil.isNotBlank(combustibleGasData.get("methodErrorFlag").toString())) return RespEntity.fail(combustibleGasData.get("msg").toString());
		allMap.put("combustibleGasData",combustibleGasData);
		//消防可视化检测
		Map<String,Object> fireFightingVisualizationData = getFireFightingVisualizationData(jsonParam);
		if(fireFightingVisualizationData.get("methodCodeFlag")!=null && StrUtil.isNotBlank(fireFightingVisualizationData.get("methodCodeFlag").toString())) return RespEntity.expire();
		if(fireFightingVisualizationData.get("methodErrorFlag")!=null && StrUtil.isNotBlank(fireFightingVisualizationData.get("methodErrorFlag").toString())) return RespEntity.fail(fireFightingVisualizationData.get("msg").toString());
		allMap.put("fireFightingVisualizationData",fireFightingVisualizationData);
		//智慧独立烟感
		Map<String,Object> smokeData = getSmokeData(jsonParam);
		if(smokeData.get("methodCodeFlag")!=null && StrUtil.isNotBlank(smokeData.get("methodCodeFlag").toString())) return RespEntity.expire();
		if(smokeData.get("methodErrorFlag")!=null && StrUtil.isNotBlank(smokeData.get("methodErrorFlag").toString())) return RespEntity.fail(smokeData.get("msg").toString());
		allMap.put("smokeData",smokeData);
		return RespEntity.success(allMap);
	}
	//获取电气火灾数据
	public Map<String,Object> getElectricFireData(JSONObject jsonParam){
		//汇总数据
		Map<String,Object> allMap = new HashMap<>();
		//一周报警
		JSON weekAlarmObject = makeDataForJSON(jsonParam,"electricfireJava","config","weekAlarm","electricfire");

		if(weekAlarmObject instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject weekAlarmObjectN = (com.alibaba.fastjson.JSONObject)weekAlarmObject;
			if(StrUtil.isNotBlank(weekAlarmObjectN.getString("methodCodeFlag"))){
				allMap.put("methodCodeFlag","1");
			} else{
				allMap.put("methodErrorFlag","1");
				allMap.put("msg",(weekAlarmObjectN.getString("msg")));
			}
			return allMap;
		}else{
			allMap.put("weekAlarmList",weekAlarmObject);
		}
		//设备统计
		com.alibaba.fastjson.JSONObject todayDeviceCountByStateObject = makeData(jsonParam,"electricfireJava","config","todayDeviceCountByState","device");
		if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodCodeFlag"))){
			allMap.put("methodCodeFlag","1");
			return allMap;
		}else if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodErrorFlag"))){
			allMap.put("methodErrorFlag","1");
			allMap.put("msg",todayDeviceCountByStateObject.getString("msg"));
			return allMap;
		}
		allMap.put("normalCount",todayDeviceCountByStateObject.get("normalCount"));
		allMap.put("alarmCount",todayDeviceCountByStateObject.get("alarmCount"));
		allMap.put("offLineCount",todayDeviceCountByStateObject.get("offLineCount"));
		allMap.put("faultCount",todayDeviceCountByStateObject.get("faultCount"));
		allMap.put("allCount",todayDeviceCountByStateObject.get("allCount"));
		return allMap;
	}
	//获取建筑用水数据
	public Map<String,Object> getWaterData(JSONObject jsonParam){
		//汇总数据
		Map<String,Object> allMap = new HashMap<>();
		//一周报警
		JSON weekAlarmObject = makeDataForJSON(jsonParam,"firewaterJava","config","weekAlarm","firewater");
		if(weekAlarmObject instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject weekAlarmObjectN = (com.alibaba.fastjson.JSONObject)weekAlarmObject;
			if(StrUtil.isNotBlank(weekAlarmObjectN.getString("methodCodeFlag"))){
				allMap.put("methodCodeFlag","1");
			} else{
				allMap.put("methodErrorFlag","1");
				allMap.put("msg",(weekAlarmObjectN.getString("msg")));
			}
			return allMap;
		}else{
			allMap.put("weekAlarmList",weekAlarmObject);
		}
		//设备统计
		com.alibaba.fastjson.JSONObject todayDeviceCountByStateObject = makeData(jsonParam,"firewaterJava","config","todayDeviceCountByState","device");
		if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodCodeFlag"))){
			allMap.put("methodCodeFlag","1");
			return allMap;
		}else if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodErrorFlag"))){
			allMap.put("methodErrorFlag","1");
			allMap.put("msg",todayDeviceCountByStateObject.getString("msg"));
			return allMap;
		}
		allMap.put("normalCount",todayDeviceCountByStateObject.get("normalCount"));
		allMap.put("alarmCount",todayDeviceCountByStateObject.get("alarmCount"));
		allMap.put("offLineCount",todayDeviceCountByStateObject.get("offLineCount"));
		allMap.put("faultCount",todayDeviceCountByStateObject.get("faultCount"));
		allMap.put("allCount",todayDeviceCountByStateObject.get("allCount"));
		return allMap;
	}
	//获取可燃气体监测数据
	public Map<String,Object> getCombustibleGasData(JSONObject jsonParam){
		//汇总数据
		Map<String,Object> allMap = new HashMap<>();
		//一周报警
		JSON weekAlarmObject = makeDataForJSON(jsonParam,"combustiblegasJava","config","weekAlarm","combustiblegas");
		if(weekAlarmObject instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject weekAlarmObjectN = (com.alibaba.fastjson.JSONObject)weekAlarmObject;
			if(StrUtil.isNotBlank(weekAlarmObjectN.getString("methodCodeFlag"))){
				allMap.put("methodCodeFlag","1");
			} else{
				allMap.put("methodErrorFlag","1");
				allMap.put("msg",(weekAlarmObjectN.getString("msg")));
			}
			return allMap;
		}else{
			allMap.put("weekAlarmList",weekAlarmObject);
		}
		//设备统计
		com.alibaba.fastjson.JSONObject todayDeviceCountByStateObject = makeData(jsonParam,"combustiblegasJava","config","todayDeviceCountByState","device");
		if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodCodeFlag"))){
			allMap.put("methodCodeFlag","1");
			return allMap;
		}else if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodErrorFlag"))){
			allMap.put("methodErrorFlag","1");
			allMap.put("msg",todayDeviceCountByStateObject.getString("msg"));
			return allMap;
		}
		allMap.put("normalCount",todayDeviceCountByStateObject.get("normalCount"));
		allMap.put("alarmCount",todayDeviceCountByStateObject.get("alarmCount"));
		allMap.put("offLineCount",todayDeviceCountByStateObject.get("offLineCount"));
		allMap.put("faultCount",todayDeviceCountByStateObject.get("faultCount"));
		allMap.put("allCount",todayDeviceCountByStateObject.get("allCount"));
		return allMap;
	}
	//获取消防可视化检测数据
	public Map<String,Object> getFireFightingVisualizationData(JSONObject jsonParam){
		//汇总数据
		Map<String,Object> allMap = new HashMap<>();
		//一周报警
		JSON weekAlarmObject = makeDataForJSON(jsonParam,"firefightingvisualizationJava","config","weekAlarm","firefightingvisualization");
		if(weekAlarmObject instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject weekAlarmObjectN = (com.alibaba.fastjson.JSONObject)weekAlarmObject;
			if(StrUtil.isNotBlank(weekAlarmObjectN.getString("methodCodeFlag"))){
				allMap.put("methodCodeFlag","1");
			} else{
				allMap.put("methodErrorFlag","1");
				allMap.put("msg",(weekAlarmObjectN.getString("msg")));
			}
			return allMap;
		}else{
			allMap.put("weekAlarmList",weekAlarmObject);
		}
		//设备统计
		com.alibaba.fastjson.JSONObject todayDeviceCountByStateObject = makeData(jsonParam,"firefightingvisualizationJava","config","todayDeviceCountByState","device");
		if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodCodeFlag"))){
			allMap.put("methodCodeFlag","1");
			return allMap;
		}else if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodErrorFlag"))){
			allMap.put("methodErrorFlag","1");
			allMap.put("msg",todayDeviceCountByStateObject.getString("msg"));
			return allMap;
		}
		allMap.put("normalCount",todayDeviceCountByStateObject.get("normalCount"));
		allMap.put("alarmCount",todayDeviceCountByStateObject.get("alarmCount"));
		allMap.put("offLineCount",todayDeviceCountByStateObject.get("offLineCount"));
		allMap.put("faultCount",todayDeviceCountByStateObject.get("faultCount"));
		allMap.put("allCount",todayDeviceCountByStateObject.get("allCount"));
		return allMap;
	}
	//获取智慧独立烟感数据
	public Map<String,Object> getSmokeData(JSONObject jsonParam){
		//汇总数据
		Map<String,Object> allMap = new HashMap<>();
		//一周报警
		JSON weekAlarmObject = makeDataForJSON(jsonParam,"independentsmokeJava","config","weekAlarm","independentsmoke");
		if(weekAlarmObject instanceof com.alibaba.fastjson.JSONObject){
			com.alibaba.fastjson.JSONObject weekAlarmObjectN = (com.alibaba.fastjson.JSONObject)weekAlarmObject;
			if(StrUtil.isNotBlank(weekAlarmObjectN.getString("methodCodeFlag"))){
				allMap.put("methodCodeFlag","1");
			} else{
				allMap.put("methodErrorFlag","1");
				allMap.put("msg",(weekAlarmObjectN.getString("msg")));
			}
			return allMap;
		}else{
			allMap.put("weekAlarmList",weekAlarmObject);
		}
		//设备统计
		com.alibaba.fastjson.JSONObject todayDeviceCountByStateObject = makeData(jsonParam,"independentsmokeJava","config","todayDeviceCountByState","device");
		if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodCodeFlag"))){
			allMap.put("methodCodeFlag","1");
			return allMap;
		}else if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodErrorFlag"))){
			allMap.put("methodErrorFlag","1");
			allMap.put("msg",todayDeviceCountByStateObject.getString("msg"));
			return allMap;
		}
		allMap.put("normalCount",todayDeviceCountByStateObject.get("normalCount"));
		allMap.put("alarmCount",todayDeviceCountByStateObject.get("alarmCount"));
		allMap.put("offLineCount",todayDeviceCountByStateObject.get("offLineCount"));
		allMap.put("faultCount",todayDeviceCountByStateObject.get("faultCount"));
		allMap.put("allCount",todayDeviceCountByStateObject.get("allCount"));
		return allMap;
	}
	//获取消防物联网数据
	public Map<String,Object> getIOTData(JSONObject jsonParam){
		//汇总数据
		Map<String,Object> allMap = new HashMap<>();
		//今日报警
		com.alibaba.fastjson.JSONObject todayAlarmObject = makeData(jsonParam,"fireFightingiotJava","config","todayAlarm","fireFightingIOT");
		if(StrUtil.isNotBlank(todayAlarmObject.getString("methodCodeFlag"))){
			allMap.put("methodCodeFlag","1");
			return allMap;
		}
		else if(StrUtil.isNotBlank(todayAlarmObject.getString("methodErrorFlag"))){
			allMap.put("methodErrorFlag","1");
			allMap.put("msg",todayAlarmObject.getString("msg"));
			return allMap;
		}
		allMap.put("todayAlarmCount",todayAlarmObject.get("allCount"));
		//设备统计
		com.alibaba.fastjson.JSONObject todayDeviceCountByStateObject = makeData(jsonParam,"fireFightingiotJava","config","todayDeviceCountByState","device");
		if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodCodeFlag"))){
			allMap.put("methodCodeFlag","1");
			return allMap;
		}else if(StrUtil.isNotBlank(todayDeviceCountByStateObject.getString("methodErrorFlag"))){
			allMap.put("methodErrorFlag","1");
			allMap.put("msg",todayDeviceCountByStateObject.getString("msg"));
			return allMap;
		}
		allMap.put("normalCount",todayDeviceCountByStateObject.get("normalCount"));
		allMap.put("alarmCount",todayDeviceCountByStateObject.get("alarmCount"));
		allMap.put("offLineCount",todayDeviceCountByStateObject.get("offLineCount"));
		allMap.put("faultCount",todayDeviceCountByStateObject.get("faultCount"));
		allMap.put("allCount",todayDeviceCountByStateObject.get("allCount"));
		return allMap;
	}


}
